<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>配件列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="refresh" content="1200">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=86e2297f">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=222aea35">
    <link rel="stylesheet" href="/dist/plugins/fixedTable/fixed-table.css"/>
    <!--<link rel="stylesheet" href="/dist/css/test.css"/>-->
    <style>
        [v-cloak] {
            display: none;
        }

        .selectOption {
            margin-right: 20px;
        }

        .selectOption span {
            color: rgb(34, 139, 238);
            font-weight: bold;
            cursor: pointer;
        }

        .content {
            padding: 0px;
        }


        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            outline: none;
        }

        .td-value span.lineOne {
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            color: #333 !important;
            text-align: left !important;
        }

        .td-value {
            text-align: center !important;
            vertical-align: middle;
            word-wrap: break-word;
            color: black !important;
        }

        .td-value span {
            /*display: inline-block;*/
            overflow: hidden;
            padding-left: 0.06rem;
            word-wrap: break-word;
            color: black !important;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .fixed-table_body tr td {
            border-right: none;
            font-size: 12px;
            text-align: center;
        }

        .fixed-table_header tr th {
            border-right: none;
            background: yellow;
            font-weight: normal;
            font-size: 12px;
        }

        .fixed-table_body tr:nth-of-type(even) {
            background: #F9F9F9;
        }

        .slide-box {
            display: -webkit-box;
            -webkit-overflow-scrolling: touch;
            height: 34px;
            line-height: 34px;
            /*background: #2a8cec;*/
            width: 100%;
            padding-left: 5px;
            border-bottom: 1px solid #2a8cec;
        }

        .rights {
            text-align: center;
            color: #000;
            font-size: 14px;
            margin-left: 10px;
            margin-right: 4px;
            margin-top: 3px;
            cursor: pointer;
        }

        .lefts {
            text-align: center;
            color: #2a8cec;
            /*background-image: url(/dist/img/tabApp.png);*/
            margin-left: 8px;
            margin-right: 8px;
            /*background-size: 100% 100%;*/
            padding: 4px 15px 5px 15px;
            border: 1px solid #2a8cec;
            border-bottom: none;
            background: #fff;
            z-index: 999;
        }

        .slide-box1 {
            display: -webkit-box;
            /* overflow-x: scroll; */
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            height: 30px;
        }

        .right {
            text-align: center;
            color: #666666;
            font-size: 12px;
            /* border-bottom: 2px solid #f8f8f8; */
            margin-left: 4px;
            margin-right: 4px;
            padding-top: 10px;
            padding-bottom: 5px;
            cursor: pointer;

        }

        .left {
            text-align: center;
            color: #228bee;
            /*border-bottom: 2px solid #228bee;*/
            margin-left: 8px;
            margin-right: 8px;
            padding-bottom: 5px;
        }

        .tryStyle {
            width: 34px;
            height: 17px;
            line-height: 17px;
            font-size: 12px;
            top: -1px;
            right: -10px;
            position: absolute;
            border-radius: 50px;
            margin-top: 4px;
            background: #FF0000;
            color: #fff;
            margin-right: -2px;
            transform: scale(0.7);
            text-align: center !important;
        }

        .userName {
            text-align: justify;
            display: inline-block;
            overflow: hidden;
            vertical-align: middle;
            height: 24px;
            line-height: 24px;
            width: 40px;
        }

        .userName:after {
            content: " ";
            display: inline-block;
            width: 100%;
        }

        .input-sm {
            border-radius: 0;
            border: 1px solid #d2d6de;
            width: 120px;
            height: 25px;
            margin-right: 10px;
        }

        .form-control {
            display: block;
            color: rgb(85, 85, 85);
            background-color: rgb(255, 255, 255);
            background-image: none;
            padding: 6px 12px;
            border-width: 1px;
            border-style: solid;
            border-image: initial;
            width: 120px;
            height: 25px;
            border: 1px solid #d2d6de;
            margin-right: 10px;
            padding-top: 0px;
            padding-bottom: 0px;
            padding-left: 6px;
            font-size: 12px;
            line-height: 25px;
            transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
        }

        span.lineOne {
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }

        body {
            overflow-y: hidden;
        }

        .fixed-table-box td {
            position: relative;
            text-align: left;
            padding: 0 2px;
            height: 25px;
            border-left: 1px solid #cbcbcd;
            border-bottom: 1px solid #cbcbcd;
        }
    </style>
</head>
<body>
<iframe id="ifExprot" style="width:0px;height:0px;display: none;" frameborder="0"></iframe>
<section class="content" id="app" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <div class="nav-tabs-custom oaReportNav" style="margin:10px 0px;">
        <input class="pull-left form-control pull-left input-sm" type="text" v-model="searchParams.startTime"
               @focus="showDatePicker($event,'startTime')" placeholder="开始时间">
        <input class="pull-left form-control pull-left input-sm" type="text" v-model="searchParams.endTime"
               @focus="showDatePicker($event,'endTime')" placeholder="结束时间">
        <template v-if="pageType != 'other'">
            <div class="pull-left">
                <select id="companyId" v-model="searchParams.companyId" class="form-control"
                        style="">
                    <option value="" selected="selected">经销商</option>
                    <option v-for="c in item.companyId" v-bind:value="c.id">{{c.name}}</option>
                </select>
            </div>
            <div class="pull-left">
                <select id="businessType" v-model="searchParams.businessType" class="form-control"
                        style="">
                    <option value="" selected="selected">业务类型</option>
                    <option v-for="b in item.businessType" v-bind:value="b.key">{{b.value}}</option>
                </select>
            </div>
        </template>
        <div class="pull-left">
            <select id="status" v-model="searchParams.status" class="form-control"
                    style="">
                <option value="" selected="selected">状态</option>
                <option v-for="b in item.serveConsultStatus" v-bind:value="b.key">{{b.value}}</option>
            </select>
        </div>
        <div class="has-feedback">
            <input type="text" id="likeSelect" class="form-controll pull-left input-sm"
                   v-model="searchParams.key" placeholder="请输入关键字"
                   size="12">
            <span id="btnQuery" class="glyphicon glyphicon-search form-control-feedback"
                  style="display:none "></span>
            <input type="button" class="btn oaBtn pull-left btn-sm" style="margin-left: 10px" value="查询"
                   class="oaBtn" @click="getList()">
            <template>
                <input type="button" class="btn oaBtn pull-left btn-sm"
                       style="margin-left: 10px;float: right !important;" value="新增"
                       class="oaBtn" @click="add()">
            </template>
        </div>
    </div>
    <div class="box-body no-padding" style="overflow: auto;margin-top:10px;display: inline-block; ">
        <div class="fixed-table-box head-fixed ">
            <div class="fixed-table_header-wraper">
                <table class="fixed-table_header " cellspacing="0" cellpadding="0" border="0">
                    <template v-if="pageType == 'machineConsultation'">
                        <thead>
                        <tr>
                            <th style="width:230px;">
                                <div class="table-cells">业务单号</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">状态</div>
                            </th>
                            <th style="width:150px">
                                <div class="table-cells">登记时间</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">来电人</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">来电号码</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">业务类型</div>
                            </th>
                            <th style="">
                                <div class="table-cells">内容详细</div>
                            </th>
                            <th style="width:200px">
                                <div class="table-cells">解决详情</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">受理责任人</div>
                            </th>
                            <th style="width: 17px;">
                                <div class="table-cells"></div>
                            </th>
                        </tr>
                        </thead>
                    </template>
                    <template v-else-if="pageType == 'accessoriesConsultation'">
                        <thead>
                        <tr>
                            <th style="width:230px">
                                <div class="table-cells">业务单号</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">来电客户</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">来电号码</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">业务类型</div>
                            </th>
                            <th style="">
                                <div class="table-cells">内容详情</div>
                            </th>
                            <th style="width:200px">
                                <div class="table-cells">解决详情</div>
                            </th>
                            <th style="width:150px">
                                <div class="table-cells">登记时间</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">受理责任人</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">来电人</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">业务状态</div>
                            </th>
                            <th style="width: 17px;">
                                <div class="table-cells"></div>
                            </th>
                        </tr>
                        </thead>
                    </template>
                    <template v-else-if="pageType == 'other'">
                        <thead>
                        <tr>
                            <th style="width:230px">
                                <div class="table-cells">业务单号</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">状态</div>
                            </th>
                            <th style="width:150px">
                                <div class="table-cells">登记时间</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">来电人</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">来电号码</div>
                            </th>
                            <th style="">
                                <div class="table-cells">内容详情</div>
                            </th>
                            <th style="width:200px">
                                <div class="table-cells">解决详情</div>
                            </th>
                            <th style="width:80px">
                                <div class="table-cells">受理责任人</div>
                            </th>
                            <th style="width: 17px;">
                                <div class="table-cells"></div>
                            </th>
                        </tr>
                        </thead>
                    </template>
                </table>
            </div>
            <div class="fixed-table_body-wraper iframeServeFixed" id="scrollDiv">
                <table class="fixed-table_body table-hover" cellspacing="0" cellpadding="0" border="0"
                       style="width: 100%;">
                    <template v-if="pageType == 'machineConsultation'">
                        <tbody>
                        <tr v-for="(item,i) in list">
                            <td style="width:230px;color: #2a8cec;cursor: pointer;" @click="turn(item)">
                                {{item.businessNo}}
                            </td>
                            <td style="width:80px">{{item.status}}</td>
                            <td style="width:150px">{{formatDate(item.createTime)}}</td>
                            <td style="width:80px"><span class="userName">{{item.callerName}}</span></td>
                            <td style="width:80px"><span class="lineOne">{{item.callerTel}}</span></td>
                            <td style="width:80px">{{item.businessType}}</td>
                            <td style=""><span class="lineOne">{{item.businessContent}}</span></td>
                            <td style="width:200px"><span class="lineOne">{{item.solveWay}}</span></td>
                            <td style="width:80px"><span class="userName">{{item.acceptName}}</span></td>
                            <template v-if="list.length>=18">
                                <td style="width: 0px;"></td>
                            </template>
                            <template v-else>
                                <td style="width: 17px;"></td>
                            </template>
                        </tr>
                        </tbody>
                    </template>
                    <template v-else-if="pageType == 'accessoriesConsultation'">
                        <tbody>
                        <tr v-for="(item,i) in list">
                            <td style="width:230px;color: #2a8cec;cursor: pointer;" @click="turn(item)">
                                {{item.businessNo}}
                            </td>
                            <td style="width:80px"><span class="userName">{{item.customerName}}</span></td>
                            <td style="width:80px"><span class="lineOne">{{item.callerTel}}</span></td>
                            <td style="width:80px">{{item.businessType}}</td>
                            <td style=""><span class="lineOne">{{item.businessContent}}</span></td>
                            <td style="width:200px"><span class="lineOne">{{item.solveWay}}</span></td>
                            <td style="width:150px">{{formatDate(item.createTime)}}</td>
                            <td style="width:80px"><span class="userName">{{item.acceptName}}</span></td>
                            <td style="width:80px"><span class="userName">{{item.callerName}}</span></td>
                            <td style="width:80px">{{item.status}}</td>
                            <template v-if="list.length>=18">
                                <td style="width: 0px;"></td>
                            </template>
                            <template v-else>
                                <td style="width: 17px;"></td>
                            </template>
                        </tr>
                        </tbody>
                    </template>
                    <template v-else-if="pageType == 'other'">
                        <tbody>
                        <tr v-for="(item,i) in list">
                            <td style="width:230px;color: #2a8cec;cursor: pointer;" @click="turn(item)">
                                {{item.businessNo}}
                            </td>
                            <td style="width:80px">{{item.status}}</td>
                            <td style="width:150px">{{formatDate(item.createTime)}}</td>
                            <td style="width:80px"><span class="userName">{{item.callerName}}</span></td>
                            <td style="width:80px"><span class="lineOne">{{item.callerTel}}</span></td>
                            <td style=""><span class="lineOne">{{item.businessContent}}</span></td>
                            <td style="width:200px"><span class="lineOne">{{item.solveWay}}</span></td>
                            <td style="width:80px"><span class="userName">{{item.acceptName}}</span></td>
                            <template v-if="list.length>=18">
                                <td style="width: 0px;"></td>
                            </template>
                            <template v-else>
                                <td style="width: 17px;"></td>
                            </template>
                        </tr>
                        </tbody>
                    </template>
                </table>
            </div>
        </div>
        <div class="oa-pager text-center" style="margin-top: 5px;">
            共
            <span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;
            <span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;
            <span class="oa-pager-button" id="first">首页</span>
            <span class="oa-pager-button" id="prev">上一页</span>
            <span class="oa-pager-button" id="next">下一页</span>
            <span class="oa-pager-button" id="last">尾页</span>
        </div>
    </div>
    <!-- /.box-body -->
</section>
<!--JQ-->
<!--插件JS-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<script>window.jQuery || document.write('<script src="/dist/plugins/jQuery/jquery-2.2.3.min.js"><\/script>', '<script src="/dist/plugins/bootstrap/js/bootstrap.min.js"><\/script>', '<script src="/dist/plugins/vue/vue.min.js"><\/script>')</script>
<script src="/dist/plugins/jQuery/jquery.cookie.min.js"></script>
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=54c6b89c"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script src="/dist/plugins/fixedTable/fixed-table.js"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                var width = $(this).outerWidth();
                if (width < 180) {
                    width = 180;
                }
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": width + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    $.wyui.page.dataUrl = server.ip + "/serveBusiness/getBusinessList.json";
    $.wyui.page.queryParams.key = '';
    $.wyui.page.queryParams.type = $.wyui.page.urlParams.type;
    $.wyui.page.queryParams.customerType = '';
    $.wyui.page.queryParams.pageSize = 30;
    $.wyui.page.queryParams.requestPage = 1;
    $.wyui.page.getByPage_callback = function () {
    };
    $.wyui.page.getByPage_scroll_callback = function (data) {
        if (data.length < $.wyui.page.queryParams.pageSize) {
            sLoad = false;
        } else {
            app.list = app.list.concat(data);
            isLoad = true;
        }
    }
    $.wyui.page.getByPage_callback_new = function (r) {
        app.list = r.records;
    };

    function refresh() {
        location.reload();
    }

    var app = new Vue({
        el: '#app',
        data: {
            pageType: "",
            isCheckedAll: false,
            list: [],
            searchParams: {
                startTime: '',
                endTime: '',
                companyId: '',
                status: '',
                businessType: '',
                key: '',
                type: $.wyui.page.urlParams.type,
            },
            item: {
                companyId: [],
                businessType: [],
                serveConsultStatus: []
            }
        },
        methods: {
            formatDate: function (now) {
                return NewDate(now).Format(TimeFormat.pcList);
            },
            turn: function (item) {
                var pageType = 'look'
                if (item.createUserId && item.createUserId == getCurrentUser().id) {
                    pageType = 'edit'
                }
                var type = $.wyui.page.urlParams.type;
                top.closeTabByPageId(type);
                top.addTabs({
                    id: type,
                    title: $.wyui.page.urlParams.type == 'machineConsultation' ? "整机咨询" : $.wyui.page.urlParams.type == "accessoriesConsultation" ? "配件咨询" : "其他咨询",
                    close: true,
                    url: "/serve/businessDetails.html?type=" + type + "&pageType=" + pageType + "&id=" + item.id
                });
            },
            //时间选择器插件
            showDatePicker: function (e, key) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.searchParams[key] = dp.cal.getNewDateStr();
                        return true;
                    },
                    dateFmt: 'yyyy-MM-dd'
                });
                $(e.target).blur();
            },
            add: function () {
                var that = this;
                var type = $.wyui.page.urlParams.type;
                top.closeTabByPageId(type);
                top.addTabs({
                    id: type,
                    title: "添加",
                    close: true,
                    url: "/serve/businessDetails.html?type=" + $.wyui.page.urlParams.type + "&pageType=edit"
                });
            },
            getList: function () {

                $.extend($.wyui.page.queryParams, trimRN(this.searchParams));
                $.wyui.page.queryParams.requestPage = 1;
                $.wyui.page.queryParams.pageSize = 30;
                $.wyui.page.getByPage();
            },
            //获取经销商下拉信息
            getCompanyIdItem: function () {
                var that = this;
                $.wyui.postMethod("/company/getCompanyList.json", {}, function (data) {
                    console.log(data);
                    that.item.companyId = data;
                });
            },
            //根据枚举表类型获取枚举数据
            getEnumByModuleType: function (moduleType, key) {
                var that = this;
                $.wyui.postMethod("/serveEnum/getEnumByModuleType.json", {moduleType: moduleType}, function (data) {
                    that.item[key] = data;
                });
            },
            getHeight: function () {
                var H = $(window).height();
                console.log(H)
                $(".iframeServeFixed").height(H - 98);
            }
        },
        mounted: function () {
            var that = this;
            that.pageType = $.wyui.page.urlParams.type;
            that.getCompanyIdItem();
            that.getEnumByModuleType('serveTypeOfService', 'businessType');
            that.getEnumByModuleType('serveConsultStatus', 'serveConsultStatus');
            that.getHeight();

        },

    });
    $(window).resize(function () {
        app.getHeight()
    })
</script>
<script>
    /************************滚动加载******************************/
    var divscroll = document.getElementById('scrollDiv');

    function divScroll() {
        var wholeHeight = divscroll.scrollHeight;
        var scrollTop = divscroll.scrollTop;
        var divHeight = divscroll.clientHeight;
        console.log(scrollTop + divHeight, wholeHeight)
        if (scrollTop + divHeight >= wholeHeight - 2) {
            //lert('滚动到底部了！');
            if (isLoad) {
                isLoad = false;
                setTimeout($.wyui.page.getByPage("scroll"), 1000);
            }
            //这里写动态加载的逻辑，比如Ajax请求后端返回下一个页面的内容
        }
    }

    divscroll.onscroll = divScroll;
</script>
<script>
    //初始化FixedTable
    $(".fixed-table-box").fixedTable();
</script>
</body>
</html>